package com.gykj.rtm.facade.admin;

import java.util.List;

import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import com.github.pagehelper.PageInfo;
import com.gykj.admin.common.entity.Resources;

@FeignClient("gykj-admin-service")
public interface ResourcesFacade {

    @RequestMapping(value =  "/resources/getAllResourcesList")
    public PageInfo<Resources> getAllResourcesList(
    		@RequestBody Resources resources,
            @RequestParam(value="currentPage",required = false, defaultValue = "1") int currentPage,
            @RequestParam(value="pageSize",required = false, defaultValue = "20") int pageSize,
            @RequestParam(value="sortColumn",required = false, defaultValue = "1") int sortColumn,
            @RequestParam(value="sortDesc",required = false, defaultValue = "1") int sortDesc
           );
    @RequestMapping(value = "/resources/getResourcesById")
    public List<Resources> getResourcesById(@RequestParam(value = "rid",required = false) Integer rid); 

    @RequestMapping(value = "/resources/loadMenu/{uid}",method=RequestMethod.GET)
    public List<Resources> loadMenu(@PathVariable(value="uid",required=false) Integer uid);

    @CacheEvict(cacheNames="/resources/resources", allEntries=true)
    @RequestMapping(value = "/resources/add")
    public String add(@RequestBody Resources resources);
    
    @CacheEvict(cacheNames="/resources/resources", allEntries=true)
    @RequestMapping(value = "/resources/delete")
    public String delete(@RequestParam(value="id",required=false) Integer id);
}
